import requests
import json

class AuthenticatedRequest:
    @staticmethod
    def get_headers():
        try:
            with open('user_session.json', 'r') as f:
                session = json.load(f)
                token = session.get('token')
                if token:
                    return {'Authorization': f'Bearer {token}'}
        except FileNotFoundError:
            pass
        return {}

    @staticmethod
    def get(url, **kwargs):
        headers = AuthenticatedRequest.get_headers()
        if 'headers' in kwargs:
            kwargs['headers'].update(headers)
        else:
            kwargs['headers'] = headers
        return requests.get(url, **kwargs)

    @staticmethod
    def post(url, **kwargs):
        headers = AuthenticatedRequest.get_headers()
        if 'headers' in kwargs:
            kwargs['headers'].update(headers)
        else:
            kwargs['headers'] = headers
        return requests.post(url, **kwargs)